////////////////////////////////////////////////////////////////////////////////
// Filename		DailyData.cpp
// Author		outphase
// Date			2011-09-12
// Comment		
////////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "DailyData.h"
#include "Article.h"

DailyData::DailyData(std::string& filename)
:m_LastArticle(0)
{
	m_FileStream.open(filename.c_str());
}

DailyData::~DailyData()
{
	if(m_LastArticle != 0)
	{
		delete m_LastArticle;
		m_LastArticle = 0;
	}

	if(m_FileStream.is_open() == true)
		m_FileStream.close();
}

Article* DailyData::GetNextArticle()
{
	if(m_LastArticle != 0)
	{
		delete m_LastArticle;
		m_LastArticle = 0;
	}

	m_LastArticle = Article::CreateFromStream(m_FileStream);
	return m_LastArticle;
}